//
//  PBContractItemController.m
//  PBHomeDemo
//
//  Created by Playboy on 2018/3/16.
//  Copyright © 2018年 tmkj. All rights reserved.
//

#import "PBContractItemController.h"
#import "PBContractDetailController.h"

@interface PBContractItemController ()
@property (strong, nonatomic) IBOutlet UIWebView *webView;

@end

@implementation PBContractItemController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self configure];
}
- (void)configure {
    [self configureView];
    [self configureData];
}

- (void)configureView {
    
}
- (void)configureData {
    [self showHud];
    [TMNetwork requestPostWithParam:@{} url:@"/sys/config" callback:^(TMBaseReqModel *model) {
        [self hideHud];
        if (model.code == 200) {
            for (NSDictionary *dic in model.data) {
                if ([dic[@"label"] isEqualToString:@"rent_contract_txt"]) {
                    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:dic[@"value"]]];
                    [self.webView loadRequest:request];
                }
            }
        }else {
            [self showHint:model.message];
        }
    }];
}

- (IBAction)agreeButtonClick:(id)sender {
    PBContractDetailController *vc = [[PBContractDetailController alloc] init];
    vc.payModel = self.payModel;
    vc.model = self.model;
    [self.navigationController pushViewController:vc animated:YES];
}


#pragma mark - super
- (void)resetNavigationBarItems {
    [super resetNavigationBarItems];
    self.title = @"合同条款";
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
